package com.clwl.supervise.superviseapp.controller.baobao;


import com.clwl.supervise.superviseapp.entity.result.ResultEntity;
import com.clwl.supervise.superviseapp.entity.supervise.AdsBaobShareSupTaskDetailEntity;
import com.clwl.supervise.superviseapp.entity.supervise.AdsBaobShareSupTaskEntity;
import com.clwl.supervise.superviseapp.service.baobao.AdsBaobShareSupTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/baobao")
public class BaobaoController {

    @Autowired
    private AdsBaobShareSupTaskService adsBaobShareSupTaskService;



    @GetMapping("getBaobaoListByCompanyCode")
    public ResultEntity<List<AdsBaobShareSupTaskEntity>> getBaobaoListByCompanyCode(String entUniqueCode){
        return ResultEntity.success(adsBaobShareSupTaskService.findList(entUniqueCode));
    }


    @GetMapping("getBaobaoDetailListById")
    public ResultEntity<List<AdsBaobShareSupTaskDetailEntity>> getBaobaoDetailListById(Long id){
        AdsBaobShareSupTaskEntity adsBaobShareSupTask = adsBaobShareSupTaskService.getById(id);
        return ResultEntity.success(adsBaobShareSupTaskService.findDetailList(adsBaobShareSupTask.getYearInfo(),adsBaobShareSupTask.getSupTaskId()));
    }
}
